
*****************ELIGIBILITY VARIABLES****************

*Complete Survey

gen complete=0
replace complete=1 if v10==1
tab complete

*Timely Survey

gen timely=1
replace timely=0 if v95<120 
replace timely=0 if v95>14400
tab timely

*Attention Check

gen attention=0
replace attention=1 if q26attn==1
tab attention

*Create restricted sample

gen eligible4=1
replace eligible4=0 if complete==0 & timely==0
replace eligible4=0 if complete==0 & attention==0
replace eligible4=0 if timely==0 & attention==0
tab eligible4

****************CONTROL CONDITION***************

gen control=.
replace control=1 if angerface==. & fearface==.
replace control=0 if angerface==1 | fearface==1
tab control


*****************MAIN INDEPENDENT VARIABLES****************

*Ideology

gen ideology=.
replace ideology=0 if q2ideolog_1==1
replace ideology=1 if q2ideolog_1==2
replace ideology=2 if q2ideolog_1==3
replace ideology=3 if q2ideolog_1==4
replace ideology=4 if q2ideolog_1==5
replace ideology=5 if q2ideolog_1==6
replace ideology=6 if q2ideolog_1==7
replace ideology=ideology/6
tab ideology

label define ideology1 0 "extremely liberal" 1 "extremely conservative"
label values ideology ideology1
tab ideology

*Partisanhip 

gen partyID=.
replace partyID=0 if q3part1==2 & q4part2b==1
replace partyID=1 if q3part1==2 & q4part2b==2
replace partyID=2 if q3part1==3 & q4part2c==2
replace partyID=2 if q3part1==4 & q4part2c==2
replace partyID=3 if q3part1==3 & q4part2c==3
replace partyID=3 if q3part1==4 & q4part2c==3
replace partyID=4 if q3part1==3 & q4part2c==1
replace partyID=4 if q3part1==4 & q4part2c==1
replace partyID=5 if q3part1==1 & q4part2a==2
replace partyID=6 if q3part1==1 & q4part2a==1
replace partyID=partyID/6
tab partyID

label define partyID1 0 "strong democrat" 1 "strong republican"
label values partyID partyID1
tab partyID

gen partyID_3cat=.
replace partyID_3cat=0 if partyID<.5&partyID>=0
replace partyID_3cat=.5 if partyID==.5
replace partyID_3cat=1 if partyID>.5&partyID<=1
tab partyID_3cat

*Party ID dummies (Independent is the excluded category)

gen partyID_rep=.
replace partyID_rep=1 if partyID_3cat==1
replace partyID_rep=0 if partyID_3cat!=1
tab partyID_rep

gen partyID_dem=.
replace partyID_dem=1 if partyID_3cat==0
replace partyID_dem=0 if partyID_3cat!=0
tab partyID_dem 

*Gender ID

gen genderID=.
replace genderID=0 if q28genderidentity==5 | v62==5
replace genderID=1 if q28genderidentity==4 | v62==4
replace genderID=2 if q28genderidentity==3 | v62==3
replace genderID=3 if q28genderidentity==2 | v62==2
replace genderID=4 if q28genderidentity==1 | v62==1
replace genderID=genderID/4
tab genderID

*Anti-Feminist Attitudes

gen Hsexism2=.
replace Hsexism2=0 if q13sex3r==1
replace Hsexism2=1 if q13sex3r==2
replace Hsexism2=2 if q13sex3r==3
replace Hsexism2=3 if q13sex3r==4
replace Hsexism2=4 if q13sex3r==5
replace Hsexism2=. if q13sex3r==6
replace Hsexism2=Hsexism2/4
tab Hsexism2

gen Hsexism4=.
replace Hsexism4=0 if q17sex7r==1
replace Hsexism4=1 if q17sex7r==2
replace Hsexism4=2 if q17sex7r==3
replace Hsexism4=3 if q17sex7r==4
replace Hsexism4=4 if q17sex7r==5
replace Hsexism4=. if q17sex7r==6
replace Hsexism4=Hsexism4/4
tab Hsexism4

alpha Hsexism2 Hsexism4, gen(hostsexism)
*(.72)

*Attitudes toward Women

gen Hsexism1=.
replace Hsexism1=0 if q11sex1==5
replace Hsexism1=1 if q11sex1==4
replace Hsexism1=2 if q11sex1==3
replace Hsexism1=3 if q11sex1==2
replace Hsexism1=4 if q11sex1==1
replace Hsexism1=. if q11sex1==6
replace Hsexism1=Hsexism1/4
tab Hsexism1

gen Hsexism3=.
replace Hsexism3=0 if q15sex5==5
replace Hsexism3=1 if q15sex5==4
replace Hsexism3=2 if q15sex5==3
replace Hsexism3=3 if q15sex5==2
replace Hsexism3=4 if q15sex5==1
replace Hsexism3=. if q15sex5==6
replace Hsexism3=Hsexism3/4
tab Hsexism3

alpha Hsexism1 Hsexism3, gen(hostsexism2)
*(.72)

*Authoritarianism Scale

gen Auth1=.
replace Auth1=0 if q7auth1==1
replace Auth1=1 if q7auth1==2
tab Auth1

label define Auth1X 0 "independence" 1 "respect elders"
label values Auth1 Auth1X
tab Auth1

gen Auth2=.
replace Auth2=0 if q8auth2r==2
replace Auth2=1 if q8auth2r==1
tab Auth2

label define Auth2X 0 "self-reliance" 1 "obedience"
label values Auth2 Auth2X
tab Auth2

gen Auth3=.
replace Auth3=0 if q9auth3==1
replace Auth3=1 if q9auth3==2
tab Auth3

label define Auth3X 0 "curiosity" 1 "good manners"
label values Auth3 Auth3X
tab Auth3

gen Auth4=.
replace Auth4=0 if q10auth4r==1
replace Auth4=1 if q10auth4r==2
tab Auth4

label define Auth4X 0 "considerate" 1 "well-behaved"
label values Auth4 Auth4X
tab Auth4

alpha Auth1 Auth2 Auth3 Auth4, gen(auth_scale)

*Ethnocentrism Scale 

gen ethno1=.
replace ethno1=0 if q20ethn1==5
replace ethno1=1 if q20ethn1==4
replace ethno1=2 if q20ethn1==3
replace ethno1=3 if q20ethn1==2
replace ethno1=4 if q20ethn1==1
replace ethno1=. if q20ethn1==6
replace ethno1=ethno1/4
tab ethno1

gen ethno2=.
*[Purity - Intergroup Ethnocentrism]
replace ethno2=0 if q21ethn2r==1
replace ethno2=1 if q21ethn2r==2
replace ethno2=2 if q21ethn2r==3
replace ethno2=3 if q21ethn2r==4
replace ethno2=4 if q21ethn2r==5
replace ethno2=. if q21ethn2r==6
replace ethno2=ethno2/4
tab ethno2

gen ethno3=.
*[Group Cohesion - Intragroup Ethnocentrism]
replace ethno3=0 if q22ethn3==5
replace ethno3=1 if q22ethn3==4
replace ethno3=2 if q22ethn3==3
replace ethno3=3 if q22ethn3==2
replace ethno3=4 if q22ethn3==1
replace ethno3=. if q22ethn3==6
replace ethno3=ethno3/4
tab ethno3

gen ethno4=.
*[Superiority - Intergroup Ethnocentrism]
replace ethno4=0 if q23ethn4r==1
replace ethno4=1 if q23ethn4r==2
replace ethno4=2 if q23ethn4r==3
replace ethno4=3 if q23ethn4r==4
replace ethno4=4 if q23ethn4r==5
replace ethno4=. if q23ethn4r==6
replace ethno4=ethno4/4
tab ethno4

gen ethno5=.
*[Devotion - Intragroup Ethnocentrism]
replace ethno5=0 if q24ethn5==5
replace ethno5=1 if q24ethn5==4
replace ethno5=2 if q24ethn5==3
replace ethno5=3 if q24ethn5==2
replace ethno5=4 if q24ethn5==1
replace ethno5=. if q24ethn5==6
replace ethno5=ethno5/4
tab ethno5

gen ethno6=.
*[Preference - Intergroup Ethnocentrism]
replace ethno6=0 if q25ethn6r==1
replace ethno6=1 if q25ethn6r==2
replace ethno6=2 if q25ethn6r==3
replace ethno6=3 if q25ethn6r==4
replace ethno6=4 if q25ethn6r==5
replace ethno6=. if q25ethn6r==6
replace ethno6=ethno6/4
tab ethno6

alpha ethno1 ethno2 ethno3 ethno4 ethno5 ethno6, gen(ethnocentric)


*****************CONTROL VARIABLES****************

*Gender

gen gender=.
replace gender=0 if q5gender_1==1
replace gender=1 if q5gender_2==1
label define genderX 0 "male" 1 "female"
label values gender genderX
tab gender

*White

gen white=0
replace white=1 if q6ethnic_1==1 & q6ethnic_2!=1 & q6ethnic_3!=1 & q6ethnic_4!=1 & q6ethnic_5!=1 & q6ethnic_6!=1 & q6ethnic_7!=1 & q6ethnic_8!=1
tab white

*Age 

gen ageN=.
replace ageN=q51age2/100 if q51age2>=18 & q51age2<=99
tab ageN

*Education

gen education=.
replace education=0 if q52educ==1
replace education=1 if q52educ==2
replace education=2 if q52educ==3
replace education=3 if q52educ==4
replace education=3 if q52educ==5
replace education=4 if q52educ==6
replace education=5 if q52educ==7
replace education=education/5
tab education

*Income

gen income=.
replace income=0 if q54income==1
replace income=1 if q54income==2
replace income=2 if q54income==3
replace income=3 if q54income==4
replace income=4 if q54income==5
replace income=5 if q54income==6
replace income=6 if q54income==7
replace income=7 if q54income==8
replace income=8 if q54income==9
replace income=9 if q54income==10
replace income=10 if q54income==11
replace income=11 if q54income==12
replace income=income/11
tab income

*Evangelic

gen evangelic=.
replace evangelic=1 if q53relig==2
replace evangelic=0 if q53relig!=2
tab evangelic


***************DEPENDENT VARIABLES***************

*Vote Choice

gen voteclinton=.
replace voteclinton=1 if q35vote==3
replace voteclinton=0 if q35vote!=3
tab voteclinton

gen votetrump=.
replace votetrump=1 if q35vote==1
replace votetrump=0 if q35vote!=1
tab votetrump


******************ANALYSIS***********************

*Figure 1

*LEFT PANEL

quietly logit voteclinton gender genderID hostsexism partyID auth_scale ethnocentric ageN education income evangelic, robust
estimates store all
quietly logit voteclinton genderID hostsexism partyID auth_scale ethnocentric ageN education income evangelic if gender==0, robust
estimates store male
quietly logit voteclinton genderID hostsexism partyID auth_scale ethnocentric ageN education income evangelic if gender==1, robust
estimates store female
quietly logit voteclinton gender genderID hostsexism partyID auth_scale ethnocentric ageN education income evangelic if white==1, robust
estimates store white
coefplot (all, label(All)) (male, label(Men)) (female, label(Women)) (white, label(Whites)), scheme(s1mono) drop(?cons gender ageN education income evangelic) xline(0) xscale(range(-8(2)8)) xtitle("Odds Ratio of Voting for Clinton") name(genderraceplot)

*RIGHT PANEL

quietly logit voteclinton genderID hostsexism auth_scale ethnocentric ageN education income evangelic if partyID_3cat==0&gender==0, robust
estimates store demmale
quietly logit voteclinton genderID hostsexism auth_scale ethnocentric ageN education income evangelic if partyID_3cat==0&gender==1, robust
estimates store demfemale
quietly logit voteclinton genderID hostsexism auth_scale ethnocentric ageN education income evangelic if partyID_3cat==1&gender==0, robust
estimates store repmale
quietly logit voteclinton genderID hostsexism auth_scale ethnocentric ageN education income evangelic if partyID_3cat==1&gender==1, robust
estimates store repfemale
coefplot (demmale, label(Dem. Men)) (demfemale, label(Dem. Women)) (repmale, label(Rep. Men)) (repfemale, label(Rep. Women)), scheme(s1mono) drop(?cons ageN education income evangelic) xscale(range(-8(2)8)) xline(0) xtitle("Odds Ratio of Voting for Clinton") name(pidplot)

graph combine genderraceplot pidplot


*Probability shifts

logistic voteclinton gender genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic, robust nolog
adjust hostsexism=0 gender genderID partyID ethnocentric auth_scale ageN education income evangelic, pr
adjust hostsexism=1 gender genderID partyID ethnocentric auth_scale ageN education income evangelic, pr

logistic voteclinton genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if gender==1, robust nolog
adjust hostsexism=0 genderID partyID ethnocentric auth_scale ageN education income evangelic if gender==1, pr
adjust hostsexism=1 genderID partyID ethnocentric auth_scale ageN education income evangelic if gender==1, pr

logistic voteclinton genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if gender==0, robust nolog
adjust hostsexism=0 genderID partyID ethnocentric auth_scale ageN education income evangelic if gender==0, pr
adjust hostsexism=1 genderID partyID ethnocentric auth_scale ageN education income evangelic if gender==0, pr


**************************APPENDIX***********************************

*Table A1

logit voteclinton gender genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic, robust
logit voteclinton genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if gender==1, robust
logit voteclinton genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if gender==0, robust
logit voteclinton gender genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if white==1, robust


*Table A2

logit voteclinton genderID hostsexism ethnocentric auth_scale ageN education income evangelic if partyID_3cat==0&gender==1, robust
logit voteclinton genderID hostsexism ethnocentric auth_scale ageN education income evangelic if partyID_3cat==0&gender==0, robust
logit voteclinton genderID hostsexism ethnocentric auth_scale ageN education income evangelic if partyID_3cat==1&gender==1, robust
logit voteclinton genderID hostsexism ethnocentric auth_scale ageN education income evangelic if partyID_3cat==1&gender==0, robust


*Table A3

logit voteclinton gender genderID hostsexism hostsexism2 partyID ethnocentric auth_scale ageN education income evangelic, robust
logit voteclinton genderID hostsexism hostsexism2 partyID ethnocentric auth_scale ageN education income evangelic if gender==1, robust
logit voteclinton genderID hostsexism hostsexism2 partyID ethnocentric auth_scale ageN education income evangelic if gender==0, robust
logit voteclinton gender genderID hostsexism hostsexism2 partyID ethnocentric auth_scale ageN education income evangelic if white==1, robust


*Table A4

logit voteclinton genderID hostsexism hostsexism2 ethnocentric auth_scale ageN education income evangelic if partyID_3cat==0&gender==1, robust
logit voteclinton genderID hostsexism hostsexism2 ethnocentric auth_scale ageN education income evangelic if partyID_3cat==0&gender==0, robust
logit voteclinton genderID hostsexism hostsexism2 ethnocentric auth_scale ageN education income evangelic if partyID_3cat==1&gender==1, robust
logit voteclinton genderID hostsexism hostsexism2 ethnocentric auth_scale ageN education income evangelic if partyID_3cat==1&gender==0, robust


*Table A5

logit votetrump gender genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic, robust
logit votetrump genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if gender==1, robust
logit votetrump genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if gender==0, robust
logit votetrump gender genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if white==1, robust


*Table A6

logit votetrump genderID hostsexism ethnocentric auth_scale ageN education income evangelic if partyID_3cat==0&gender==1, robust
logit votetrump genderID hostsexism ethnocentric auth_scale ageN education income evangelic if partyID_3cat==0&gender==0, robust
logit votetrump genderID hostsexism ethnocentric auth_scale ageN education income evangelic if partyID_3cat==1&gender==1, robust
logit votetrump genderID hostsexism ethnocentric auth_scale ageN education income evangelic if partyID_3cat==1&gender==0, robust


*Table A7

logit voteclinton gender genderID hostsexism partyID ideology ethnocentric auth_scale ageN education income evangelic, robust
logit voteclinton genderID hostsexism partyID ideology ethnocentric auth_scale ageN education income evangelic if gender==1, robust
logit voteclinton genderID hostsexism partyID ideology ethnocentric auth_scale ageN education income evangelic if gender==0, robust
logit voteclinton gender genderID hostsexism partyID ideology ethnocentric auth_scale ageN education income evangelic if white==1, robust


*Table A8

logit voteclinton genderID hostsexism ideology ethnocentric auth_scale ageN education income evangelic if partyID_3cat==0&gender==1, robust
logit voteclinton genderID hostsexism ideology ethnocentric auth_scale ageN education income evangelic if partyID_3cat==0&gender==0, robust
logit voteclinton genderID hostsexism ideology ethnocentric auth_scale ageN education income evangelic if partyID_3cat==1&gender==1, robust
logit voteclinton genderID hostsexism ideology ethnocentric auth_scale ageN education income evangelic if partyID_3cat==1&gender==0, robust


*Table A9

logit votetrump gender genderID hostsexism partyID ideology ethnocentric auth_scale ageN education income evangelic, robust
logit votetrump genderID hostsexism partyID ideology ethnocentric auth_scale ageN education income evangelic if gender==1, robust
logit votetrump genderID hostsexism partyID ideology ethnocentric auth_scale ageN education income evangelic if gender==0, robust
logit votetrump gender genderID hostsexism partyID ideology ethnocentric auth_scale ageN education income evangelic if white==1, robust


*Table A10

logit votetrump genderID hostsexism ideology ethnocentric auth_scale ageN education income evangelic if partyID_3cat==0&gender==1, robust
logit votetrump genderID hostsexism ideology ethnocentric auth_scale ageN education income evangelic if partyID_3cat==0&gender==0, robust
logit votetrump genderID hostsexism ideology ethnocentric auth_scale ageN education income evangelic if partyID_3cat==1&gender==1, robust
logit votetrump genderID hostsexism ideology ethnocentric auth_scale ageN education income evangelic if partyID_3cat==1&gender==0, robust


*Table A11

logit voteclinton gender genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if control==1, robust
logit voteclinton genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if control==1&gender==1, robust
logit voteclinton genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if control==1&gender==0, robust
logit voteclinton gender genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if control==1&white==1, robust


*Table A12

logit voteclinton genderID hostsexism ethnocentric auth_scale ageN education income evangelic if control==1&partyID_3cat==0&gender==1, robust
logit voteclinton genderID hostsexism ethnocentric auth_scale ageN education income evangelic if control==1&partyID_3cat==0&gender==0, robust
logit voteclinton genderID hostsexism ethnocentric auth_scale ageN education income evangelic if control==1&partyID_3cat==1&gender==1, robust
logit voteclinton genderID hostsexism ethnocentric auth_scale ageN education income evangelic if control==1&partyID_3cat==1&gender==0, robust


*Table A13

logit votetrump gender genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if control==1, robust
logit votetrump genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if control==1&gender==1, robust
logit votetrump genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if control==1&gender==0, robust
logit votetrump gender genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if control==1&white==1, robust


*Table A14

logit votetrump genderID hostsexism ethnocentric auth_scale ageN education income evangelic if control==1&partyID_3cat==0&gender==1, robust
logit votetrump genderID hostsexism ethnocentric auth_scale ageN education income evangelic if control==1&partyID_3cat==0&gender==0, robust
logit votetrump genderID hostsexism ethnocentric auth_scale ageN education income evangelic if control==1&partyID_3cat==1&gender==1, robust
logit votetrump genderID hostsexism ethnocentric auth_scale ageN education income evangelic if control==1&partyID_3cat==1&gender==0, robust


*Table A15

logit voteclinton gender genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if eligible4==1, robust
logit voteclinton genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if eligible4==1&gender==1, robust
logit voteclinton genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if eligible4==1&gender==0, robust
logit voteclinton gender genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if eligible4==1&white==1, robust


*Table A16

logit voteclinton genderID hostsexism ethnocentric auth_scale ageN education income evangelic if eligible4==1&partyID_3cat==0&gender==1, robust
logit voteclinton genderID hostsexism ethnocentric auth_scale ageN education income evangelic if eligible4==1&partyID_3cat==0&gender==0, robust
logit voteclinton genderID hostsexism ethnocentric auth_scale ageN education income evangelic if eligible4==1&partyID_3cat==1&gender==1, robust
logit voteclinton genderID hostsexism ethnocentric auth_scale ageN education income evangelic if eligible4==1&partyID_3cat==1&gender==0, robust


*Table A17

logit votetrump gender genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if eligible4==1, robust
logit votetrump genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if eligible4==1&gender==1, robust
logit votetrump genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if eligible4==1&gender==0, robust
logit votetrump gender genderID hostsexism partyID ethnocentric auth_scale ageN education income evangelic if eligible4==1&white==1, robust


*Table A18

logit votetrump genderID hostsexism ethnocentric auth_scale ageN education income evangelic if eligible4==1&partyID_3cat==0&gender==1, robust
logit votetrump genderID hostsexism ethnocentric auth_scale ageN education income evangelic if eligible4==1&partyID_3cat==0&gender==0, robust
logit votetrump genderID hostsexism ethnocentric auth_scale ageN education income evangelic if eligible4==1&partyID_3cat==1&gender==1, robust
logit votetrump genderID hostsexism ethnocentric auth_scale ageN education income evangelic if eligible4==1&partyID_3cat==1&gender==0, robust


*Table A19

logit voteclinton c.hostsexism##i.gender genderID partyID ethnocentric auth_scale ageN education income evangelic, robust
logit voteclinton c.hostsexism##i.partyID_rep c.hostsexism##i.partyID_dem gender genderID ethnocentric auth_scale ageN education income evangelic, robust


*Table A20

logit votetrump c.hostsexism##i.gender genderID partyID ethnocentric auth_scale ageN education income evangelic, robust
logit votetrump c.hostsexism##i.partyID_rep c.hostsexism##i.partyID_dem gender genderID ethnocentric auth_scale ageN education income evangelic, robust
